Try dumping, when a SPIR-T pass panics, its in-progress spirt::Module state.#362
Try dumping, when a SPIR-T pass panics, its in-progress spirt::Module state.#362eddyb merged 1 commit intoRust-GPU:mainfrom
spirt::Module state.#362Conversation
LegNeato
left a comment
There was a problem hiding this comment.
This looks ok, but I can't help but think this should be tracing spans and items. Then you would get nesting and such for free.
That would be useful for some stuff, but, even ignoring the I wouldn't mind automating those strings, but right now they're quite arbitrary, e.g. after Rust-GPU/spirt#25 the let profiler = before_pass("mem::analyze_accesses", module);
spirt::passes::qptr::analyze_mem_accesses(module, &SPIRT_MEM_LAYOUT_CONFIG);
after_pass(Some(module), profiler);with // FIXME(eddyb) this doesn't really belong in `qptr`.
pub fn analyze_mem_accesses(module: &mut Module, layout_config: &crate::mem::LayoutConfig) {
crate::mem::analyze::GatherAccesses::new(module.cx(), layout_config)
.gather_accesses_in_module(module);
}So there's not even any function named But even if we take the function's path and strip either |
|
You can create trace spans programmatically with custom names, it doesn't have to be a function nor a proc macro. Tracing is in rustc proper and lots of crates (not sure what is actually instrumented though). But yeah, it doesn't help with table headings unless you installed your own subscriber and collected and then output (that might actually be interesting). |

While SPIR-T passes should, in principle, never panic, it can still happen (esp. with WIP code, where e.g.
assert!s ortodo!()s might be overrepresented etc.), and before this PR, the partially modified SPIR-T module would be completely lost in the--dump-spirt-passesoutput.And because incomplete SPIR-T mutation could result in extremely malformed modules, this PR also wraps the SPIR-T pretty-printing in
std::panic::catch_unwind, removing one pass' "after" state, at a time, from the pretty-printed versions, while it still panics, and showing an extra warning (with all the pass names that couldn't be printed) if that was necessary at all.Also, there's a minor ergonomic fix in that
after_passdoesn't need to also be passed the same string asbefore_pass(sinceSpirtDumpGuardis tracking it anyway).